/* Copyright  2009
   @Author
   Richard Changde Yin            e-mail yinchangde@hotmail.com

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; version 2 of the License.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
   
/**
 * @filename: select_max_min_finder_subselect.h
 */ 


#ifndef __SELECT_MIN_MAX_FINDER_SUBSELECT_H__
#define __SELECT_MIN_MAX_FINDER_SUBSELECT_H__


/* used in independent ALL/ANY optimisation */
class select_max_min_finder_subselect :public select_subselect
{
  Item_cache *cache;
  
  bool (select_max_min_finder_subselect::*op)();
  
  bool fmax;
public:
  select_max_min_finder_subselect(Item_subselect *item_arg, bool mx)
    :select_subselect(item_arg), cache(0), fmax(mx)
  {}
  
  void cleanup();
  
  bool send_data(List<Item> &items);
  
  bool cmp_real();
  
  bool cmp_int();
  
  bool cmp_decimal();
  
  bool cmp_str();
};

#endif /* __SELECT_MIN_MAX_FINDER_SUBSELECT_H__ */
